package wang.raye.springcloud.zuul;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.boot.autoconfigure.web.ErrorController;

/**
 * Create by Raye on 2018/7/12
 */
@RestController
public class ErrorHandlerController implements ErrorController  {

    /**
     * 出异常后进入该方法，交由下面的方法处理
     */
    @Override
    public String getErrorPath() {
        return "/error";
    }

    @RequestMapping("error")
    public String error(){
        return "{\"status\":\"fail\",\"message\":\"服务不可用\"}";
    }
}
